#pragma once

#include <string>
#include <fstream>
#include <vector>

#include "vertex_formats.h"
#include "glm/glm.hpp"

namespace TorLib {

	class StlObject
	{ 
  public:
    StlObject();
		StlObject( const std::string& filename ); // From file
    ~StlObject();

    std::string getIdentity() const;
	const std::vector<XYZ>&   getNormals();
    const std::vector<XYZ>&   getVertices();
		void setScale( float newScale );
		void save( std::ofstream& stream, bool binary );

    std::string                       _identity;				// I put the filename in here,
    FILE*                             _stl_file;

		std::vector< XYZ > _vertices;        // storage, each three makes a triangle
		std::vector< XYZ > _normals;         // with one normal for each triangle
		bool isLoaded;
	private:
		float _getFloat();
		unsigned int _getUint();
		unsigned long _getUli();
		bool _readStlBinary( const std::string& filename );
		
		
	};

}
